# Contributor: TBK <alpine@jjtc.eu>
# Maintainer: TBK <alpine@jjtc.eu>
pkgname=nebula
pkgver=1.6.0
pkgrel=0
pkgdesc="Scalable overlay networking tool with a focus on performance, simplicity and security"
url="https://github.com/slackhq/nebula"
license="MIT"
# armv7 blocked by test failure https://github.com/slackhq/nebula/issues/212
arch="all !armhf !armv7"
pkgusers="$pkgname"
pkggroups="$pkgname"
install="$pkgname.pre-install"
makedepends="go libcap"
subpackages="$pkgname-openrc"
source="https://github.com/slackhq/nebula/archive/v$pkgver/nebula-$pkgver.tar.gz
	$pkgname.initd
	"

build() {
	make BUILD_NUMBER="$pkgver" bin
}

check() {
	make test
}

package() {
	install -Dm750 -o nebula -g nebula nebula -t "$pkgdir"/usr/sbin/
	setcap cap_net_admin+ep "$pkgdir"/usr/sbin/nebula

	install -Dm755 nebula-cert -t "$pkgdir"/usr/bin/

	install -Dm644 examples/config.yml -t "$pkgdir"/etc/$pkgname

	install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
}

sha512sums="
766f2eaa3fb3b4eb24b9036e0ceb5bf0bd342205bc8c38416e51a694ab146de02c25122a4bad7b0d27726426b5ca81699967b70cbe65f9612dd2322744a22c74  nebula-1.6.0.tar.gz
9124a728ccbf554cbafd9bdf7ed3ab72837ec12bb3d6cf65286c30dd67f6b4de41f3bbe3392a7607977c2d59af3403309643a9ab889fd96516e4bc0692a98f1d  nebula.initd
"
